﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="GalleryEdit.aspx.cs" Inherits="Marta.buchalska.wesele.Admin.GalleryEdit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:LinqDataSource runat="server" ID="GaleryDS" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
        EntityTypeName="" TableName="Photo_galleries" Where="ID == Int32(@ID)">
        <WhereParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="gid" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:DetailsView runat="server" Height="50px" Width="125px" DataSourceID="GaleryDS"
        AutoGenerateRows="False">
        <Fields>
            <asp:BoundField DataField="Name" HeaderText="Nazwa galerii" SortExpression="Name" />
        </Fields>
    </asp:DetailsView>
    <asp:Button Text="Usuń tą galerię " runat="server" ID="btnDelGallery" OnClick="btnDelGallery_Click" />
    <asp:DataList runat="server" DataSourceID="PhotosGalleryDS" DataKeyNames="ID" OnDeleteCommand="Unnamed2_DeleteCommand">
        <ItemTemplate>
            <div class="">
                <asp:ImageButton ImageUrl="~/Styles/images/cancel_16.png" CommandName="Delete" CommandArgument='<%#Eval("ID")  %>'
                    ToolTip="Usuń" runat="server" />
                <asp:Image ToolTip='<%#Eval("Name") %>' ID="Image1" runat="server" ImageUrl='<%# Eval("URL") %>'
                    Height='75' Width='50' />
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
            </div>
        </ItemTemplate>
    </asp:DataList>
    <div id='addPhotoContainer'>
        <asp:DetailsView runat="server" Height="50px" Width="225px" AutoGenerateRows="False"
            ID="newPhoto" DataSourceID="PhotoInsertDS" DefaultMode="Insert" AutoGenerateInsertButton="True"
            OnItemInserting="newPhoto_ItemInserting">
            <Fields>
                <asp:TemplateField HeaderText="Plik zdjęcia : " SortExpression="URL">
                    <InsertItemTemplate>
                        <asp:FileUpload runat="server" ID="photoFile" />
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Opis" SortExpression="Description">
                    <InsertItemTemplate>
                        <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("Description") %>'
                            Rows='10' Columns='50' TextMode="MultiLine"></asp:TextBox>
                    </InsertItemTemplate>
                </asp:TemplateField>
            </Fields>
        </asp:DetailsView>
        <asp:LinqDataSource ID="PhotoInsertDS" runat="server" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
            EntityTypeName="" EnableInsert="true" TableName="Photos">
        </asp:LinqDataSource>
    </div>
    <asp:LinqDataSource ID="PhotosGalleryDS" runat="server" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
        EntityTypeName="" TableName="Photos" EnableDelete="true" Where="Photo_gallery_id == Int32(@Photo_gallery_id)">
        <WhereParameters>
            <asp:QueryStringParameter Name="Photo_gallery_id" QueryStringField="gid" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
</asp:Content>
